home *** CD-ROM | disk | FTP | other *** search
- <IMG NAME=arrow SRC="arrow.gif" ALIGN=left>
-
- <DIV ID=banner STYLE="position: absolute; left: 72; top: 15;">
- <FONT FACE="Arial, Helvetica" SIZE=+2>
- Exposing Page Elements Cross-Browser
- </FONT>
- </DIV>
-
-
- <SCRIPT>
- // reflectElements:
- //
- // Reflects elements from the document.all collection up one
- // level to underneath the document object.
- //
- function reflectElements()
- {
- for (var i=0; i<document.all.length; i++)
- {
- // If an element has an id and does not already exist
- // under the document object, reflect the element object
- // underneath the document object.
-
- if (document.all[i].id != "" &&
- !eval("document." + document.all[i].id))
- {
- eval("document." + document.all[i].id +
- " = document.all[" + i + "];");
- }
- }
- }
-
- // Detect if browser is IE4 and if so, reflect page elements up
- // to document object.
- //
- if (navigator.appName.indexOf("Internet Explorer") != -1 &&
- navigator.appVersion.charAt(0) == '4')
- reflectElements();
- </SCRIPT>
-
-
- <BR><BR>
- <P>The <TT>DIV</TT> element is normally reflected as
- <TT>document.banner</TT> in Communicator 4.0 and
- <TT>document.all['banner']</TT> in IE4. Using this script to
- manually reflect all named page elements beneath the document
- object allows both browsers to access the <TT>DIV</TT> element using
- <TT>document.banner</TT>.</P>
-
- <P>The attributes of the <TT>DIV</TT> element that are reflected in both
- browsers include:</P>
-
- <BLOCKQUOTE>
- <SCRIPT>
- document.writeln("<B>id:</B> " + document.banner.id + "<BR>");
- </SCRIPT>
- </BLOCKQUOTE>
-
- <P>The <TT>IMG</TT> element is normally reflected as
- <TT>document.arrow</TT> and <TT>document.images['arrow']</TT> in both
- Communicator 4.0 and IE4.</P>
-
- <P>The attributes of the <TT>IMG</TT> element that are reflected in both
- browsers include:</P>
-
- <BLOCKQUOTE>
- <SCRIPT>
- document.writeln("<B>name:</B> " + document.arrow.name + "<BR>");
- document.writeln("<B>src:</B> " + document.arrow.src + "<BR>");
- document.writeln("<B>width:</B> " + document.images['arrow'].width +
- "<BR>");
- document.writeln("<B>height:</B> " + document.images['arrow'].height +
- "<BR>");
- </SCRIPT>
- </BLOCKQUOTE>
-